import hashlib


def main():
    base_string = "geekbang"
    nonce = 10000
    count = 0
    while True:
        target_string = base_string + str(nonce)
        pow_hash = hashlib.sha256(target_string).hexdigest()
        count = count + 1
        if pow_hash.startswith("0000"):
            print pow_hash
            print "nonce: %s  scan times: %s" % (nonce, count)
            break
        nonce = nonce + 1

if __name__ == '__main__':
    main()
